// common/http.api.js

import * as user from './modules/user.js';

// api 接口管理
const install = (Vue, vm) => {

	Vue.prototype.$api  = {
		// test get loading
		//登录接口
		login: (data = {}) => vm.$u.post('/login.php', data),
		//注册接口
		register: (data = {}) => vm.$u.post('/user/register.php', data),
		// 验证手机号是否注册接口
		hadsms: (data = {}) => vm.$u.post('/user/verifyPhone.php', data),
		// 确认是否登录接口
		beforeenter: () => vm.$u.get('/isLogin.php',{}),
		// 获取验证码
		smspass: (data = {}) => vm.$u.post('/user/sms.php', data),
		// 获得当前登录用户信息
		userMsg: () => vm.$u.get('/user/currentUser.php', {}),
		// 修改头像接口
		setUserPhotoes: (data = {}) => vm.$u.post('/user/upLoadAvatar.php', data),
		//修改当前登录用户信息
		msgChange: (data = {}) => vm.$u.post('/user/modifyingCurrentUser.php', data),
		// 退出登录
		userOut: () => vm.$u.post('/user/userOut.php', {}),
		// 修改密码
		newPass: (data = {}) => vm.$u.post('/user/modifyingCurrentUserPassword.php', data),
		// 获得公共用户信息
		getOtherUserMsg: (data = {}) => vm.$u.post('/user/modifyingCurrentUserPassword.php', data),
		// 上传图片处理接口
		setUserPhoto: (data = {}) => vm.$u.post('/common/filesUpload.php', data),
		// 发布文章话题
		setNewTitle: (data = {}) => vm.$u.post('/art/post.php', data),
		// 发布话题分类
		setNewClass: (data = {}) => vm.$u.post('/category/post.php', data),
		// 获得文章信息
		gettitleMsg: (data = {}) => vm.$u.post('/art/list.php', data),
		// 获得话题分类信息
		gettitleClass: (data = {}) => vm.$u.post('/category/list.php', data),
		// 点赞文章
		goodUser: (data = {}) => vm.$u.post('/user/user-ratings.php', data),
		// 获得阅读量
		getLookNum: (params = {}) => vm.$u.get('/art/articleViews.php', params),
		//获得地图信息
		getmap: (params = {}) => vm.$u.get('/map/onlineUsers.php', params),
		//获得文章信息
		goodTitle: (params = {}) => vm.$u.get('/art/artPraise.php', params),
		//获取当前话题评论
		getToaking: (params = {}) => vm.$u.get('/comment/commentList.php', params),
		//收藏话题
		collection: (data = {}) => vm.$u.post('/user/add_user_collection.php', data),
		// 发布评论
		postPing:(data = {}) => vm.$u.post('/comment/post.php', data),
		//获得公共用户信息
		getPublicMsg:(data = {}) => vm.$u.post('/user/userPublicInfo.php', data),
		// 获得各种收藏
		getCollection: (params = {}) => vm.$u.get('/user/myFavorite.php', params),
		
		user
	}
}

export default {
	install
}
